#ifndef USBBULK_H_
#define USBBULK_H_

#include "HAL4D13.h"
#include "UFI.h"

#define CBW_LENGTH 31
/*FSM Status Define*/
#define USB_BULK_IDLE 0
#define USB_BULK_CBW 1
#define USB_BULK_DATA_IN 2
#define USB_BULK_DATA_OUT 3
#define USB_BULK_STALL 4
#define USB_BULK_CSW 5
/*CSW status*/
#define CSW_GOOD 1
#define CSW_BAD 2


typedef struct _USB_BULK_FSM{
	char CBWbuf[31];
	char usbBulkEPOutStatus;
	char usbBulkEPInStatus;	
	char usbBulkFSMStatus;
	
	char dCBWSignatureBuf[4];
	char dCBWTagBuf[4];
	int dCBWDataTransferLength;
	char bmCBWFlags;
	char bCBWLUN;
	char bCBWCBLength;
	char CBWCB[16];
	char CSWStatus;
	char UFI_LBA;
	char UFI_LBLength;
	int bulkDataTransferLength;
	char *bulkDataTransferAddress;
	char bulkDataOutCount;
} USB_BULK_FSM;

typedef struct _USB_CSW{
	char dCSWSignature[4];
	char dCSWTag[4];
	char dCSWDataResidue[4];
	char bCSWStatus;
} USB_CSW;

#endif
/////////



